# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=volume_key
pkgver=0.3.9
pkgrel=3
pkgdesc="A library for manipulating storage volume encryption keys and storing them separately from volumes to handle forgotten passphrases"
arch=('i686' 'x86_64')
url="https://pagure.io/volume_key"
license=('GPL')
depends=('cryptsetup' 'nss' 'gpgme' 'python')
makedepends=('swig')
source=("https://github.com/felixonmars/volume_key/archive/volume_key-$pkgver.tar.gz")
sha512sums=('f013cecee09429a1bcabcce0ec1e9c531fa396a1233f90f1f09272dd8a2e3a0e013eb2f3fb5c215abb15225445feb05cee175a06f06ae5e0220cc953ab80a027')

prepare() {
  cd "$srcdir"/volume_key-volume_key-$pkgver
  sed -e 's/-lpython\$(PYTHON_VERSION)/-lpython$(PYTHON_VERSION)m/' -i Makefile.am
  autoreconf -i

  find . -name ".pyc" -delete
}

build() {
  cd "$srcdir"/volume_key-volume_key-$pkgver
  ./configure --prefix=/usr
  make PYTHON_CPPFLAGS="$(pkg-config --cflags python3)"
}

package() {
  cd "$srcdir"/volume_key-volume_key-$pkgver
  make DESTDIR="$pkgdir" install
  sed -i '/#include <config.h>/d' "$pkgdir"/usr/include/volume_key/libvolume_key.h
}
